#include <bits/stdc++.h>
using namespace std;
multiset<pair<int, int>, greater<pair<int, int> > > s;
multiset<pair<int, int>, greater<pair<int, int> > >::iterator it;
int main() {
  int n, k, x;
  cin >> n >> k;
  int rating = 0;
  for (int i = 0; i < n; i++) {
    cin >> x;
    s.insert(make_pair(x % 10, -x));
    rating += x / 10;
  }
  while (k) {
    it = s.begin();
    if (k < (10 - it->first) || it->second == -100) break;
    k -= (10 - it->first);
    int newval = it->second - (10 - it->first);
    s.erase(it);
    s.insert(make_pair(0, newval));
    rating++;
  }
  cout << rating;
  return 0;
}
