#include <bits/stdc++.h>
using namespace std;
bool Beat(string s) {
  for (int i = 0; i < s.size(); ++i)
    if (s[i] == '0') return true;
  return false;
}
int main() {
  int n, d, c = 0, Max = 0;
  cin >> n >> d;
  string s;
  bool cont = false;
  for (int i = 0; i < d; ++i) {
    cin >> s;
    if (Beat(s)) {
      cont = true;
    } else
      cont = false;
    if (cont) {
      c++;
      Max = max(Max, c);
    } else {
      c = 0;
    }
  }
  cout << Max;
  return 0;
}
