#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) {
  if (a == 0) return b;
  return gcd(b % a, a);
}
long long int power(long long int x, long long int y, long long int p) {
  long long int res = 1;
  x = x % p;
  while (y > 0) {
    if (y & 1) res = (res * x) % p;
    y = y >> 1;
    x = (x * x) % p;
  }
  return res;
}
bool comp(int a, int b) {
  if (a % 10 > b % 10) return true;
  return false;
}
int main() {
  int n, k;
  cin >> n >> k;
  int a[n];
  vector<int> v;
  for (int(i) = 0; (i) < (n); (i)++) {
    cin >> a[i];
    if (a[i] % 10 > 0) v.push_back(a[i]);
  }
  sort(v.begin(), v.end(), comp);
  for (int i = 0; i < v.size() && k > 0; i++) {
    while (v[i] % 10 != 0 && k > 0) {
      v[i]++;
      k--;
    }
  }
  for (int i = 0; i < n; i++) {
    if (a[i] % 10 == 0) v.push_back(a[i]);
  }
  for (int i = 0; i < v.size() && k > 0; i++) {
    v[i] = v[i] + k;
    k = v[i] - 100;
  }
  int ans = 0;
  for (int i = 0; i < v.size(); i++) {
    if (v[i] >= 100)
      ans += 10;
    else
      ans += (v[i] / 10);
  }
  cout << ans;
  return 0;
}
