#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n, k;
  cin >> n >> k;
  vector<int> count(110, 0);
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    count[x]++;
  }
  int ok = 1;
  while (ok) {
    ok = 0;
    for (int resto = 9; resto >= 0; resto--) {
      for (int level = 0; level < 100; level++) {
        if (level % 10 == resto) {
          long long contribu = min((10LL - resto) * count[level], k);
          if (k < (10 - resto)) continue;
          k -= contribu;
          contribu /= (10LL - resto);
          count[level + 10 - resto] += contribu;
          count[level] -= contribu;
          if (contribu > 0) ok = 1;
        }
      }
    }
  }
  long long ans = 0;
  for (int i = 0; i <= 100; i++) {
    ans += (i / 10) * count[i];
  }
  cout << ans << '\n';
  return 0;
}
