#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, d, c = 0, m = 0;
  cin >> n >> d;
  string s;
  while (d--) {
    cin >> s;
    if (s.find('0') == string::npos)
      c = 0;
    else {
      c++;
      m = max(m, c);
    }
  }
  cout << m;
}
