P30022 [洛谷] [COCI2022-2023#3] Estimathon
普及
题目描述

Problem Background

Paula and Domagoj are about to organize an exciting team competition called Estimathon. They have prepared the questions and are now setting up the room for it.

Problem Description

In a flash, Domagoj has placed $n$ tables in the room. Now they need to add chairs. They have chairs in various colors. There are $m$ colors, and the $i$-th color has $a_i$ chairs. Each team consists of four members. Therefore, for each table, Paula and Domagoj need to add 4 chairs. They want to set up the room as well as possible. To achieve this, they have agreed on the following conditions:
- The chairs at each table must be of the same color.
- At least one table must use chairs of each color.

Due to their excessive concern for the perfection of the room, they suddenly realize that the evaluation has already begun. Please help them determine if there is a possible arrangement that meets these conditions.

Input Format

The first line contains two integers $n, m$, representing the number of tables and the number of chair colors, respectively.

The second line contains $m$ integers $a_i$, where the $i$-th number represents the number of chairs of the $i$-th color.

Output Format

A single line containing a string.

If a solution meeting the conditions can be found, output DA;

otherwise, output NE.

Sample Input and Output

Sample Input #1

7 3
5 21 9

Sample Output #1

DA

Sample Input #2

5 4
8 5 10 3

Sample Output #2

NE

Sample Input #3

6 5
5 5 5 5 5

Sample Output #3

NE

Notes

[Sample Explanation #2]

We can have 5 tables each with chairs of the same color, but we cannot have a table with the fourth color, so the second condition cannot be met.

[Data Range]

Subtask Score Special Conditions
1 11 $a_1 = ... = a_m = 4$
2 39 No special restrictions

For $100\%$ of the data, the conditions $1 \leq n, m \leq 100, 1 \leq a_i \leq 100$ are satisfied.

This problem is worth 50 points.

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
7 3 5 21 9
样例输出
DA