#include <bits/stdc++.h>
using namespace std;
long long n, k, kol, koll, z, ans, dp[202][6010];
vector<pair<long long, long long> > a;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> z;
    kol = 0;
    while (z % 2 == 0) {
      z /= 2;
      kol++;
    }
    koll = 0;
    while (z % 5 == 0) {
      z /= 5;
      koll++;
    }
    a.push_back({kol, koll});
  }
  for (int j = 0; j <= k; j++)
    for (int l = 0; l <= 6000; l++) dp[j][l] = -1e8;
  dp[0][0] = 0;
  for (int i = 0; i < n; i++)
    for (int j = k - 1; j >= 0; j--)
      for (int l = 0; l <= 6000; l++)
        if (dp[j][l] >= 0)
          dp[j + 1][l + a[i].second] =
              max(dp[j + 1][l + a[i].second], dp[j][l] + a[i].first);
  for (long long i = 0; i <= 6000; i++) ans = max(ans, min(i, dp[k][i]));
  cout << ans;
  return 0;
}
