#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
constexpr int N = 2e5 + 5;
string s;
int k;
int get(int d) {
  int ans = 1;
  for (int i = 0, j; i + d < s.size();) {
    j = i + d - 1;
    while (j > i && s[j] != ' ' && s[j] != '-') j--;
    if (j == i) return INT32_MAX;
    i = j + 1;
    ans++;
  }
  return ans;
}
void Solve() {
  cin >> k;
  getline(cin, s);
  getline(cin, s);
  int l = 1, r = s.size(), mid, ans;
  while (l <= r) {
    mid = (l + r) >> 1;
    if (get(mid) <= k)
      r = mid - 1, ans = mid;
    else
      l = mid + 1;
  }
  cout << ans;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  Solve();
  return 0;
}
