#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, d, maxStreak = 0, currentStreak = 0;
  string h, p;
  cin >> n >> d;
  p.assign(n, '1');
  for (int i = 0; i < d; i++) {
    cin >> h;
    if (h.compare(p) == 0)
      currentStreak = 0;
    else
      currentStreak++;
    maxStreak = max(maxStreak, currentStreak);
  }
  cout << maxStreak << endl;
  return 0;
}
