lasers.cpp: In function 'int main()':
lasers.cpp:15:9: warning: unused variable 'j' [-Wunused-variable]
  int i, j;
         ^
lasers.cpp:17:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d%d", &N, &MM);
  ~~~~~^~~~~~~~~~~~~~~~~
lasers.cpp:20:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d", &K);
   ~~~~~^~~~~~~~~~
lasers.cpp:22:59: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   for(i=1; i<=K; i++) scanf("%d", &A[i]), S[i]=S[i-1]+A[i], D-=A[i];
                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~