#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e16;
const long long MOD = 1e9 + 7;
long long mod_add(long long a, long long b) { return (a + b) % MOD; }
long long mod_sub(long long a, long long b) { return (a - b + MOD) % MOD; }
long long mod_mul(long long a, long long b) { return a * b % MOD; }
long long H, n;
int main() {
  cin >> H >> n;
  vector<long long> d(n);
  long long sum = 0;
  for (int i = 0; i < (n); i++) {
    cin >> d[i];
    sum += d[i];
  }
  if (sum >= 0) {
    long long bH = H;
    long long ans = 0;
    for (int i = 0; i < (n); i++) {
      ans++;
      bH += d[i];
      if (bH <= 0) {
        cout << ans << endl;
        return 0;
      }
    }
    cout << -1 << endl;
    return 0;
  }
  sum = abs(sum);
  long long lb = -1, ub = H / sum + 10;
  while (ub - lb > 1) {
    long long mid = (ub + lb) / 2;
    long long bH = H - mid * sum;
    bool ok = false;
    for (int i = 0; i < (n); i++) {
      bH += d[i];
      if (bH <= 0) {
        ok = true;
        break;
      }
    }
    if (ok)
      ub = mid;
    else
      lb = mid;
  }
  long long ans = ub * n;
  H -= ub * sum;
  if (H <= 0) {
    cout << ans << endl;
    return 0;
  }
  for (int i = 0; i < (n); i++) {
    ans++;
    H += d[i];
    if (H <= 0) {
      cout << ans << endl;
      break;
    }
  }
}
