#include <bits/stdc++.h>
using namespace std;
int main(void) {
  ios ::sync_with_stdio(0);
  cin.tie(0);
  int n, d, sum = 0, ans = 0;
  cin >> n >> d;
  int a[d];
  for (int i = 0; i <= d - 1; i++) {
    string s;
    cin >> s;
    bitset<100> b(s);
    if (b.count() == n) {
      a[i] = 0;
    } else {
      a[i] = 1;
    }
  }
  for (int i = 0; i <= d - 1; i++) {
    if (a[i] == 1) {
      sum++;
    } else {
      ans = max(ans, sum);
      sum = 0;
    }
  }
  ans = max(ans, sum);
  cout << ans << endl;
  return 0;
}
