#include <bits/stdc++.h>
using namespace std;
int main() {
  int n = 0, d = 0, count = 0, maxCount = 0;
  cin >> n >> d;
  string s = "";
  for (int i = 0; i < d; i++) {
    cin >> s;
    int res = 1;
    for (int j = 0; j < s.size(); j++) {
      res &= (s[j] - '0');
    }
    if (res == 1) {
      maxCount = max(count, maxCount);
      count = 0;
    } else {
      count++;
    }
  }
  maxCount = max(count, maxCount);
  cout << maxCount;
  return 0;
}
