#include <bits/stdc++.h>
using namespace std;
const int sz = 200010;
long long int a[sz], s[sz];
long long int poss(long long int n, long long int k, long long int h) {
  long long int dm = s[n] * k;
  h += dm;
  if (h <= 0) {
    return n * k;
  }
  for (int i = 0; i < n; i++) {
    h += a[i];
    if (h <= 0) {
      return n * k + i + 1;
    }
  }
  return -1;
}
int main() {
  long long int h, n;
  cin >> h >> n;
  s[0] = 0;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    s[i + 1] = a[i];
    s[i + 1] += s[i];
  }
  if (s[n] >= 0) {
    for (int i = 0; i < n; i++) {
      h += a[i];
      if (h <= 0) {
        cout << i + 1;
        return 0;
      }
    }
    cout << -1;
    return 0;
  }
  long long int val = abs(h / s[n]);
  val++;
  val = val * 1000;
  long long int left = 0, right = val, ans = val;
  while (left <= right) {
    long long int mid = (left + right) / 2, val = poss(n, mid, h);
    if (val != -1) {
      ans = val;
      right = mid - 1;
    } else {
      left = mid + 1;
    }
  }
  if (ans == 1000000000) {
    ans = -1;
  }
  cout << ans << endl;
  return 0;
}
