#include <bits/stdc++.h>
using namespace std;
long long n, k;
vector<long long> v;
bool test(int x) {
  int aux = k - 1;
  int sum = 0;
  bool ok = 1;
  for (int i = 0; i < n; i++) {
    if (sum + v[i] <= x or aux == 0) {
      sum += v[i];
    } else {
      sum = 0;
      i--;
      aux--;
    }
  }
  if (sum > x)
    return 0;
  else
    return 1;
}
int main(void) {
  ios_base::sync_with_stdio(false);
  cin >> k;
  long long maxi = 0;
  string s;
  getline(cin, s);
  getline(cin, s);
  long long cnt = 0, sum = 0;
  for (int i = 0; i < s.size(); i++) {
    cnt++;
    if (s[i] == ' ' or s[i] == '-') {
      v.emplace_back(cnt);
      sum += cnt;
      maxi = max(maxi, cnt);
      cnt = 0;
      n++;
    }
  }
  v.emplace_back(cnt);
  n++;
  maxi = max(maxi, cnt);
  sum += cnt;
  long long lo = 1, hi = sum + 1;
  while (lo < hi) {
    int mi = (lo + hi) / 2;
    if (test(mi))
      hi = mi;
    else
      lo = mi + 1;
  }
  cout << lo << endl;
  return 0;
}
