#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  long long r;
  while (b != 0) {
    r = a % b;
    a = b;
    b = r;
  }
  return a;
}
long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
const int maxn = 100010;
int n, k;
int a[maxn];
int cnt[10];
void solve() {
  scanf("%d%d", &n, &k);
  int ans = 0;
  for (int i = (0); i < (n); i++) {
    scanf("%d", a + i);
    ans += a[i] / 10;
    cnt[a[i] % 10]++;
  }
  for (int i = (10) - 1; i >= (1); i--) {
    int d = min(cnt[i], k / (10 - i));
    ans += d;
    k -= (10 - i) * d;
  }
  ans += k / 10;
  ans = min(ans, 10 * n);
  printf("%d", ans);
}
int main() {
  solve();
  return 0;
}
