#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, d, mx = 0, days = 0;
  cin >> n >> d;
  for (int i = 0; i < d; i++) {
    string s;
    cin >> s;
    int win = 0;
    for (int j = 0; j < n; j++) {
      if (s[j] == '0') {
        win = 1;
        break;
      }
    }
    if (win)
      days++;
    else
      days = 0;
    mx = max(mx, days);
  }
  cout << mx;
}
