#include <bits/stdc++.h>
using namespace std;
pair<long long, long long> a[100005];
void solve() {
  long long n, k;
  cin >> n >> k;
  for (long long i = 0; i < n; ++i) {
    cin >> a[i].second;
    a[i].first = (10 - a[i].second % 10) % 10;
  }
  sort(a, a + n);
  for (long long i = 0; i < n; ++i) {
    long long diff = min(k, a[i].first);
    a[i].second += diff;
    k -= diff;
  }
  long long score = 0;
  for (long long i = 0; i < n; ++i) {
    score += a[i].second / 10;
  }
  if (k == 0) {
    cout << score << '\n';
    return;
  } else {
    long long s = 0;
    for (long long i = 0; i < n; ++i) {
      s += a[i].second;
    }
    s += k;
    s = min(s, 100 * n);
    cout << s / 10 << '\n';
    return;
  }
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
