#include <bits/stdc++.h>
using namespace std;
int n;
long long h, d[200001], ans, R = 0, maxR = 0, rd;
int main() {
  cin >> h >> n;
  long long temp = h;
  for (int i = 1; i <= n; i++) {
    cin >> d[i];
    temp += d[i];
    R += d[i];
    maxR = min(R, maxR);
    if (temp <= 0) {
      cout << i;
      return 0;
    }
  }
  if (R >= 0) {
    cout << -1;
    return 0;
  }
  h += maxR;
  rd = (h + abs(R) - 1) / abs(R);
  h += rd * R;
  h -= maxR;
  for (int i = 1; i <= n; i++) {
    h += d[i];
    if (h <= 0) {
      cout << rd * n + i;
      return 0;
    }
  }
  for (int i = 1; i <= n; i++) {
    h += d[i];
    if (h <= 0) {
      cout << rd * (n + 1) + i;
      return 0;
    }
  }
}
