#include <bits/stdc++.h>
using namespace std;
string intostr(int x) {
  stringstream ss;
  ss << x;
  string str = ss.str();
  return str;
}
char Uplowch(char ch) {
  if (ch >= 'A' && ch <= 'Z') ch += 32;
  return ch;
}
char Lowupch(char ch) {
  if (ch >= 'a' && ch <= 'z') ch -= 32;
  return ch;
}
bool Isalpha(char ch) {
  if ((ch >= 'A' && ch <= 'Z') || (ch >= 'a' && ch <= 'z')) return true;
  return false;
}
int Strtoint(string str) {
  stringstream ss(str);
  int x = 0;
  ss >> x;
  return x;
}
string Intostr(int x) {
  stringstream ss;
  ss << x;
  string str = ss.str();
  return str;
}
int dx[] = {0, 0, -1, 1};
int dy[] = {1, -1, 0, 0};
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n, k;
  int a[100019];
  cin >> n >> k;
  int sum = 0;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    sum += a[i] / 10;
    a[i] %= 10;
  }
  sort(a, a + n);
  reverse(a, a + n);
  for (int i = 0; i < n; i++) {
    if (k >= 10 - a[i]) {
      sum++;
      k -= (10 - a[i]);
    }
  }
  cout << min(10 * n, sum + k / 10) << endl;
  return 0;
}
