#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int h, n;
  cin >> h >> n;
  long long int a[n];
  long long int sum = INT_MAX, temp = 0;
  for (long int i = 0; i < n; i++) {
    cin >> a[i];
    temp += a[i];
    sum = min(sum, temp);
  }
  if (sum + h <= 0) {
    long int kk = 0;
    for (long int i = 0; i < n; i++) {
      h += a[i];
      if (h <= 0) {
        kk = i + 1;
        break;
      }
    }
    cout << kk;
  } else if (temp >= 0)
    cout << "-1" << endl;
  else {
    long long int ans =
        ((sum + h) / abs(temp) + (bool)((sum + h) % (abs(temp)))) * n;
    h += ((sum + h) / abs(temp) + (bool)((sum + h) % (abs(temp)))) * temp;
    for (long int i = 0; i < n; i++) {
      h += a[i];
      if (h <= 0) {
        ans += i + 1;
        break;
      }
    }
    cout << ans;
  }
}
