#include <bits/stdc++.h>
using namespace std;
int n, k, ans;
pair<int, int> ar[100005];
void solve() {
  cin >> n >> k;
  for (int i = 0; i < n; ++i) {
    cin >> ar[i].second;
    ar[i].first = (10 - ar[i].second % 10);
    ans += ar[i].second / 10;
  }
  sort(ar, ar + n);
  for (int i = 0; i < n; ++i) {
    if (ar[i].first > k || ans == n * 10) break;
    k -= ar[i].first;
    ans++;
  }
  ans += min(n * 10 - ans, k / 10);
  cout << ans;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  solve();
  return 0;
}
