#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 10;
long long vec[maxn], font[maxn];
long long hp, n;
long long mx, sum;
int main() {
  ios::sync_with_stdio(false);
  cin >> hp >> n;
  for (int i = 1; i <= n; ++i) {
    cin >> vec[i];
    vec[i] *= -1;
    sum += vec[i];
    font[i] = font[i - 1] + vec[i];
    mx = i == 1 ? font[i] : max(mx, font[i]);
  }
  if (mx < hp && sum <= 0) {
    cout << -1 << endl;
    return 0;
  }
  if (mx >= hp) {
    for (int i = 1; i <= n; ++i)
      if (font[i] >= hp) {
        cout << i << endl;
        return 0;
      }
  }
  long long num = (hp - mx) % sum ? (hp - mx) / sum + 1 : (hp - mx) / sum;
  hp -= sum * num;
  num *= n;
  for (int i = 1; i <= n; ++i)
    if (font[i] >= hp) {
      num += i;
      break;
    }
  cout << num << endl;
  return 0;
}
