#include <bits/stdc++.h>
using namespace std;
template <typename X>
inline X abs(const X& a) {
  return a < 0 ? -a : a;
}
template <typename X>
inline X sqr(const X& a) {
  return a * a;
}
const int INF = 1e9 + 1;
const long long INF1 = 1e18 + 1;
const int size = 1e5 + 2;
const double eps = 0.0001;
const long double PI = 3.1415926535897932384626433832795;
const int MOD = 1000000007;
const int INF2 = 0x3f3f3f3f;
const long long INFF = 1LL << 60;
void solution();
void include_file();
long long bin_search(long long left, long long right);
int main() {
  ios_base::sync_with_stdio(false);
  solution();
  return 0;
}
void include_file() {
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
}
void yes() { cout << "YES"; }
void no() { cout << "NO"; }
namespace bits {
template <typename X>
inline X MAX(const X& a, const X& b) {
  return b & ((a - b) >> 31) | a & (~(a - b) >> 31);
}
template <typename X>
inline X MIN(const X& a, const X& b) {
  return a & ((a - b) >> 31) | b & (~(a - b) >> 31);
}
bool check2(const long long n) { return n > 0 && (n & (n - 1)); }
long long ostatok2(const long long n, const long long m) { return m & (n - 1); }
template <typename X>
void SWAP(X& a, X& b) {
  a ^= b;
  b ^= a;
  a ^= b;
}
}  // namespace bits
void solution() {
  int n, k;
  cin >> n >> k;
  int a[n];
  pair<int, int> b[n];
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
    b[i].first = 10 - a[i] % 10;
    b[i].second = i;
  }
  sort(b, b + n);
  for (int i = 0; i < n; ++i) {
    if (k >= b[i].first && b[i].first != 10) {
      k -= b[i].first;
      a[b[i].second] += b[i].first;
    }
  }
  sort(a, a + n);
  for (int i = n - 1; i >= 0; --i) {
    int z = 100 - a[i];
    if (k >= z) {
      a[i] += z;
      k -= z;
    } else
      a[i] += k, k = 0;
  }
  int res = 0;
  for (int i = 0; i < n; ++i) res += a[i] / 10;
  cout << res;
}
