#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long n, k;
  cin >> n >> k;
  long long rating = 0;
  long long extras = 0;
  vector<long long> temp;
  for (int i = 0; i < n; i++) {
    long long x;
    cin >> x;
    rating += (x / 10);
    x = 100 - x;
    if ((x % 10)) temp.push_back(x % 10);
    extras += (x - (x % 10));
  }
  sort(temp.begin(), temp.end());
  int i = 0;
  while (i < temp.size()) {
    if (k - temp[i] >= 0) {
      rating++;
      k -= temp[i];
      i++;
    } else
      break;
  }
  rating += min(k / 10, extras / 10);
  cout << rating << '\n';
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  solve();
}
