#include <bits/stdc++.h>
using namespace std;
struct abc {
  long long int y, x;
};
bool compare(abc a1, abc a2) {
  if (a1.x == a2.x) return a1.y < a2.y;
  return a1.x < a2.x;
}
long long int countDivisors(long long int n) {
  long long int cnt = 0;
  for (long long int i = 1; i <= sqrt(n); i++) {
    if (n % i == 0) {
      if (n / i == i)
        cnt++;
      else
        cnt = cnt + 2;
    }
  }
  return cnt;
}
const long long int mod = 1e9 + 7;
long long int n, m, x, y, l, r, ans, k, q, w, h;
string second, p;
map<long long int, long long int> mp;
void solve() {
  cin >> n >> k;
  long long int a[n], sum = 0;
  vector<long long int> v;
  for (long long int i = 0; i < n; i++) {
    cin >> a[i];
    ans += a[i] / 10;
    long long int x = a[i] % 10;
    if (x % 10 != 0)
      x = 10 - x;
    else
      x = 0;
    if (x) v.push_back(x);
    a[i] += x;
    sum += (100 - a[i]);
  }
  sort(v.begin(), v.end());
  for (long long int i = 0; i < v.size(); i++) {
    if (k >= v[i])
      ans++, k -= v[i];
    else {
      k = 0;
      break;
    }
  }
  ans += min(sum, k) / 10;
  cout << ans;
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  solve();
}
