#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, d, c = 0, mx = -1;
  string s;
  bool flag;
  cin >> n >> d;
  for (int i = 0; i < d; i++) {
    cin >> s;
    flag = false;
    for (int j = 0; j < s.length(); j++) {
      if (s[j] == '0') flag = true;
    }
    if (flag)
      c++;
    else
      c = 0;
    mx = max(mx, c);
  }
  cout << mx << endl;
  return 0;
}
