#include <bits/stdc++.h>
using namespace std;
int main() {
  long long h, n, newH = 0;
  cin >> h >> n;
  long long a[n];
  long long ans = 1e18;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    newH += a[i];
    if (h + newH <= 0) return cout << i + 1, 0;
  }
  if (newH >= 0) return cout << -1, 0;
  long long change = 0;
  for (int i = 0; i < n; i++) {
    change += a[i];
    long long diff = ceil((h + change) / (double)-newH);
    ans = min(ans, diff * n + i + 1);
  }
  cout << ans << endl;
}
