#include <bits/stdc++.h>
using namespace std;
long long H, d[200002], ans;
int n;
int main(void) {
  cin >> H >> n;
  long long curr = 0, mini = 100;
  for (int i = 0; i < n; i++) {
    cin >> d[i];
    curr += d[i];
    mini = min(curr, mini);
  }
  if (mini >= 0) {
    cout << -1 << endl;
    exit(0);
  }
  if (H + mini <= 0) {
    int i;
    for (i = 0; i < n; i++) {
      H += d[i];
      if (H <= 0) break;
    }
    cout << (i + 1) << endl;
    exit(0);
  }
  if (curr >= 0) {
    cout << -1 << endl;
    exit(0);
  }
  ans = (H + mini) / (-curr);
  if ((H + mini) % (-curr) != 0) ans++;
  H += ans * curr;
  ans *= n;
  for (int i = 0; i < n; i++) {
    if (H <= 0) break;
    ans++;
    H += d[i];
  }
  cout << ans << endl;
}
