#include <bits/stdc++.h>
using namespace std;
template <class T>
inline void umax(T &a, T b) {
  if (a < b) a = b;
}
template <class T>
inline void umin(T &a, T b) {
  if (a > b) a = b;
}
int n, k, res;
multiset<pair<int, int> > s;
int main() {
  cin >> n >> k;
  for (int i = 1, x; i <= n; i++) {
    cin >> x;
    res += x / 10;
    if (x != 100) s.insert({10 - (x % 10), x});
  }
  while (!s.empty()) {
    auto pq = *s.begin();
    if (pq.first > k || pq.second == 100) break;
    res++;
    k -= pq.first;
    s.erase(s.find(pq));
    s.insert({10, pq.first + pq.second});
  }
  cout << res;
  return !1;
}
