#include <bits/stdc++.h>
using namespace std;
const int MAXD = 64 * 200 + 64 * 200;
const int OFFSET = 64 * 200;
int dp[205][MAXD];
void marmot0814() {
  int n, k;
  cin >> n >> k;
  vector<pair<int, int> > arr;
  for (int i = 0; i < n; i++) {
    long long v;
    cin >> v;
    pair<int, int> x = {0, 0};
    while (v % 2 == 0) {
      x.first++, v /= 2;
    }
    while (v % 5 == 0) {
      x.second++, v /= 5;
    }
    arr.push_back(x);
  }
  memset(dp, 0xc4, sizeof(dp));
  dp[0][OFFSET] = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = k; j >= 1; j--) {
      int diff = arr[i - 1].second - arr[i - 1].first;
      for (int d = 0; d < MAXD; d++) {
        if (d - diff >= 0 && d - diff < MAXD && dp[j - 1][d - diff] >= 0) {
          if (diff > 0) {
            if (d - diff - OFFSET >= 0) {
              dp[j][d] =
                  max(dp[j][d], dp[j - 1][d - diff] +
                                    min(arr[i - 1].first, arr[i - 1].second));
            } else {
              dp[j][d] =
                  max(dp[j][d], dp[j - 1][d - diff] +
                                    min(arr[i - 1].first, arr[i - 1].second) +
                                    min(abs(d - diff - OFFSET), abs(diff)));
            }
          } else {
            if (d - diff - OFFSET <= 0) {
              dp[j][d] =
                  max(dp[j][d], dp[j - 1][d - diff] +
                                    min(arr[i - 1].first, arr[i - 1].second));
            } else {
              dp[j][d] =
                  max(dp[j][d], dp[j - 1][d - diff] +
                                    min(arr[i - 1].first, arr[i - 1].second) +
                                    min(abs(d - diff - OFFSET), abs(diff)));
            }
          }
        }
      }
    }
  }
  int ans = 0;
  for (int i = 0; i < MAXD; i++) ans = max(ans, dp[k][i]);
  cout << ans << '\n';
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int t = 1, kase = 0;
  while (t--) {
    marmot0814();
  }
}
