#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  pair<long long, long long> tab[100010];
  long long n, k;
  cin >> n >> k;
  for (long long i = 1; i <= n; i++) {
    cin >> tab[i].second;
    long long atas = (tab[i].second / 10) + (tab[i].second % 10 != 0);
    atas *= 10;
    tab[i].first = atas - tab[i].second;
  }
  sort(tab + 1, tab + n + 1);
  for (int i = 1; i <= n; i++) {
    if (tab[i].first == 0) continue;
    if (k <= 0) break;
    if (tab[i].first >= k) {
      tab[i].second += k;
      tab[i].first = 0;
      k = 0;
    } else {
      tab[i].second += tab[i].first;
      k -= tab[i].first;
      tab[i].first = 0;
    }
  }
  k -= k % 10;
  sort(tab + 1, tab + n + 1);
  for (int i = 1; i <= n; i++) {
    int sisa = 100 - tab[i].second;
    if (sisa > k) {
      tab[i].second += k;
      break;
    } else {
      tab[i].second += sisa;
      k -= sisa;
    }
  }
  int ans = 0;
  for (int i = 1; i <= n; i++) ans += (tab[i].second / 10);
  cout << ans << "\n";
}
