#include <bits/stdc++.h>
using namespace std;
int main() {
  long long hp, n, mstate, mtot, ind = -1;
  cin >> hp >> n;
  long long ar[n];
  mtot = 0;
  mstate = 1e9 + 7;
  for (int i = 0; i < n; i++) {
    cin >> ar[i];
    mtot += ar[i];
    if (mtot < mstate) {
      mstate = mtot;
      ind = i;
    }
  }
  hp += mstate;
  if (hp <= 0) {
    hp -= mstate;
    for (int i = 0; i < n; i++) {
      hp += ar[i];
      if (hp <= 0) {
        cout << i + 1 << endl;
        return 0;
      }
    }
  }
  if (mtot >= 0) {
    cout << -1 << endl;
    return 0;
  }
  long long cnt = (hp - mtot - 1) / (-mtot);
  long long sisa = hp - mstate + cnt * mtot;
  cnt *= n;
  for (int i = 0; i < n; i++) {
    if (sisa <= 0) {
      cout << cnt + i << endl;
      return 0;
    }
    sisa += ar[i];
  }
  cout << cnt + n << endl;
}
